<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>商品添加</title>
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<% include("/admin/resource/common_css.html"){} %>  
	</head>	
	<body>
		<% include("/admin/common/header.html"){} %>
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>
			<div class="main-container-inner">
			  <% include("/admin/common/menu.html",{currentstr:"商品"}){} %>
				<div class="main-content">
				 <% include("/admin/common/breadcrumb.html",{breadaddfirst:"系统管理",breadaddsecond:"商品管理",breadaddthird:"商品添加"}){} %>
					<div class="page-content">
			       	   <form id="myform"  method="POST"  action="save"> 
				       	 <div style="margin:auto; width:75%;">
				       	    <div class="fl">
								<div class="fl">商品分类：</div> 
							    <div class="fl w800">
							       ${category.alias_name!}
							         <input type="hidden" name="goods.cat_id" value="${category.id!}">
							    </div>
						    </div>
						    <div class="fl">
								<div class="fl">商品名称：</div> 
							    <div class="fl">
							      <input type="text" name="goods.goods_name" id="goods_name" value="${goods.goods_name!}" class="w800">
							    </div>
							   
						    </div >
						    <div class="fl">
						      <div class="fl">商品货号：</div>  
								<div class="fl">
								  <input type="text" name="goods.goods_sn" id="goods_name" value="${goods.goods_sn!}" class="w800">
			                    </div> 
						    </div>
						    <div class="fl">
							    <div class="fl">商品标签：</div>  
								<div class="fl">
								   <input type="text" name="goods.tag" id="goods_name" value="${goods.tag!}" class="w800">
								   <p class="tip mb10">标签用逗号(,)分隔,建议商品标签不小于 2个。</p>
			                    </div> 
						      </div>
						      <div class="fl">
						         <div class="fl">上架状态：</div> 
							     <div class="fl w250">
							         <div>
									    	<%if(goods.is_delete! !=2){%>
										    	 <label class="ml30">
										    		<input name="goods.is_delete" type="radio" class="ace" value="1" checked="checked">
										    		<span class="lbl">立即上架</span>
										    	</label>	
										    	<label class="ml30">
										    	   <input name="goods.is_delete" type="radio" class="ace" value="2" >
										    		<span class="lbl">放入仓库</span>
										    	 </label>
									    	<%}else{%>
										    	 <label class="ml30">
										    		 <input name="goods.is_delete" type="radio" class="ace" value="1">
										    		 <span class="lbl">立即上架</span>
										          </label>	
										    	  <label class="ml30">
										    		 <input name="goods.is_delete" type="radio" class="ace" value="2" checked="checked">
										    	     <span class="lbl">放入仓库</span>
										    	  </label>
									    	<%}%>
								     </div>
							     </div>
							     <div class="fl">基础价格：</div> 
							     <div class="fl w200">
							         <div>
									     <input class="input-sm w100" type="text" name="goods.base_price"  value="${goods.share_percen!}">	
								     </div>
							     </div>
							     <div class="fl">分成占比：</div> 
							     <div class="fl w200">
							         <div>
									     <input class="input-sm w50" type="text" name="goods.share_percen" placeholder="20%"  value="${goods.share_percen!}">	
								     </div>
							     </div>
						      </div>
						      <div class="fl mb15" >
						         <div class="fl">　封面图：</div> 
							     <div class="fl w800"  >
							        <div id="photoContainer" class="fl w800">
							          <img width='700px' height="200px" src="${goods.goods_image!}"/>
							        </div>
							         <div class="fl w800" ">
								        <div style="margin: 30px 0 0 300px;">
								          <input type="file" id="file_upload" name="file_upload" >
								           <input type="hidden" id="imgurl" name="goods.goods_image" value="${goods.goods_image!}">
						                   <input type="hidden" id="delimage" name="delimage">
								        </div>
							        </div>
							     </div>
						       </div>
						       <div class="fl mb15" >
						         <div class="fl">SKU设置：</div> 
							     <div class="fl w800">
							        <%
							        var values;
							        for(attribute in attributes){
							          values=@com.jd.fruit.model.admin.shop.Attribute.getValByAttr(attribute.id);
							        %>
							         <div class="fl ml15 mt10 w80 ">${attribute.attr_name!}:</div>
							         <div class="fl ml15 mt10 w715">
						                <%for(value in values){%>
						                   <a class="ml25 btn">${value.attr_value!}</a>
						                <%}%>
							         </div>
							        <%}%>
							     </div>
						      </div>
						      <div>
						         <input type="hidden" name="goods_image" value="http://dsdfsdf/sdfcsdf">
						         <input type="hidden" name="goods_image" value="http://dsdfsdf/sdfcsdf">
						      </div>
						      <div class="fl mb15" >
						      
						     　　	<div>
						          <input type="text"  class="input-sm" name="attrFirst" value="" >  
						          <input type="text"  class="input-sm" name="attrSecond" value="" >  
						          <input type="text"  class="input-sm" name="price" value="" >
						          <input type="text"  class="input-sm" name="stocks" value="" >
						          <input type="text"  class="input-sm" name="sales" value="" >
						       	</div>
						       	<div>
						          <input type="text"  class="input-sm" name="attrFirst" value="" >  
						          <input type="text"  class="input-sm" name="attrSecond" value="" >  
						          <input type="text"  class="input-sm" name="price" value="" >
						          <input type="text"  class="input-sm" name="stocks" value="" >
						          <input type="text"  class="input-sm" name="sales" value="" >
						       	</div>
						       	
						      </div>
							<div class="fl">
							<!-- <div class="fl">商品简述：</div>
							 <div class="fl">
							   <textarea name="goods.goods_brief" style="margin: 0px 0px 10px; width: 807px; height: 63px;"></textarea>
							 </div>  
							 <div></div><div></div>  
							</div>
							<div class="fl">
							 <div class="fl">商品描述：</div>
							 <div class="fl">
							  <div style="pading-bottom:10px;">
								  <script id="editor" type="text/plain" name="goods.goods_desc" style="width:807px;height:450px;">${school.description!}</script>
							  </div>
							 </div>  
							</div>
					        -->
					        </div> 
					     </div>
					     <div class="fl form-actions " style="width: 100%">
						  <button class="btn btn-success" id="submit"  type="submit">保存</button>
						    <input type="hidden" name="goods.id" value="${goods.id!}"/>
						     <input type="hidden" name="oprtype" value="${oprtype!}"/>
					    </div>
				     </form> 
				</div>
				<% include("/admin/common/acesetting.html"){}%>
			</div><!-- /.main-container-inner -->
		</div><!-- /.main-container -->
		</div>
	<% include("/admin/common/footer.html"){} %>
	<% include("/admin/resource/common_js.html"){} %>
	 
    <script type="text/javascript" charset="utf-8" src="${host}/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${host}/ueditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="${host}/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script src="${ctx!}/js/admin/goods.js"  type="text/javascript" charset="utf-8"></script>
    <script>
     
     var editor = new baidu.editor.ui.Editor({ toolbars:[['Source','Paragraph','RowSpacing','FontFamily','Bold','RemoveFormat','ForeColor','FontSize','FullScreen','simpleupload','insertimage','ForeColor','FontSize','JustifyCenter','JustifyCenter','JustifyRight']] }); editor.render("editor");
     document.write("<script type='text/javascript' src='${ctx}/plugin/uploadify/jquery.uploadify.min.js?" + new Date()+ "'></s" + "cript>"); 
	           var imgName="";
			    $(function(){
				      $("#file_upload").uploadify({
						        'height'        : 35,  
						        'swf'           : '${ctx}/plugin/uploadify/uploadify.swf', 
						        'uploader'      : 'uploadImage', 
						        'width'         : 100,
						        'removeTimeout' :3,
						        'fileTypeExts'  : '*.jpeg;*.png;*.jpg', 
						        'method':'get',  
						        'buttonClass': "btn btn-success fileinput-button",    
		                        'buttonText': '<strong>上传图片</strong> ',
						        'onUploadSuccess' : function(file,data,response) {//成功完成文件上传时触发一次
						              var jsonObj=jQuery.parseJSON(data);    
						              imgName=jsonObj.imgName;
									  $('#photoContainer').html("<img width='700px' src='${ctx}/upload/shop/goods/"+imgName+"'/>");
									  $("#imgurl").val('${ctx}/upload/shop/goods/'+imgName); 
						        },
						        'onUploadStart': function (file) { 
						             var imgurl=  $("#imgurl").val();
						             var delName=imgurl.substring(imgurl.lastIndexOf("/")+1,imgurl.length); 
						             var delstr=$("#delimage").val();
						             $("#delimage").val(delstr+delName+";"); 
						           //编辑时重新获得图片名称
						           // if(imgName.length<2){
						           //  imgName=imgurl.substring(imgurl.lastIndexOf("/")+1,imgurl.length); 
						           //}
				                   $("#file_upload").uploadify("settings", "formData", {'imgName': imgName });  
				           }
					  });
	          });
	</script>
</body>
</html>
